<template>
    <div class="hign_template">
        <div class="title">高级设置</div>
        <div class="list">
            <div class="item">
                <div class="label">语言</div>
                <div class="value">
                    <div>
                        <app-button3 v-model="state.formData.hign.language.type" :options="state.map.languageType" />
                    </div>
                    <div style="margin-top: 8px;" v-if="state.formData.hign.language.type == 1">
                        <el-select v-model="state.formData.hign.language.languages" multiple collapse-tags
                            placeholder="选择语言" style="width: 90%">
                            <el-option v-for="item in state.map.languages" :key="item.value" :label="item.label"
                                :value="item.value" />
                        </el-select>
                    </div>

                </div>
            </div>

            <div class="item">
                <div class="label">时区</div>
                <div class="value">
                    <div>
                        <app-button3 v-model="state.formData.hign.timeZone.type" :options="state.map.timeZoneType" />
                    </div>
                    <div style="margin-top: 8px;" v-if="state.formData.hign.timeZone.type == 1">
                        <el-select v-model="state.formData.hign.timeZone.timeZone" placeholder="选择时区"
                            style="width: 90%">
                            <el-option v-for="item in state.map.timeZones" :key="item.value" :label="item.label"
                                :value="item.value" />
                        </el-select>
                    </div>

                </div>
            </div>

            <div class="item">
                <div class="label">地理位置</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.location.show" :options="state.map.locationShow" />
                    <app-button3 v-if="state.formData.hign.location.show == 1"
                        v-model="state.formData.hign.location.type" :options="state.map.locationType"
                        style="margin-top: 8px;" />
                    <div class="conent_list"
                        v-if="state.formData.hign.location.show == 1 && state.formData.hign.location.type == 1">
                        <div class="content_item">
                            <div class="content_label">经度</div>
                            <div class="content_value">
                                <el-input-number controls-position="right"
                                    v-model="state.formData.hign.location.longitude" style="width: 100%"
                                    placeholder="经度" />
                            </div>
                        </div>
                        <div class="content_item">
                            <div class="content_label">纬度</div>
                            <div class="content_value">
                                <el-input-number controls-position="right"
                                    v-model="state.formData.hign.location.latitude" style="width: 100%"
                                    placeholder="纬度" />
                            </div>
                        </div>
                        <div class="content_item">
                            <div class="content_label">精度(米)</div>
                            <div class="content_value">
                                <el-input-number controls-position="right"
                                    v-model="state.formData.hign.location.accuracy" style="width: 100%"
                                    placeholder="精度" />
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="item">
                <div class="label">分辨率</div>
                <div class="value">
                    <el-select v-model="state.formData.hign.resolution.type" placeholder="选择服务商" style="width: 90%">
                        <el-option v-for="item in state.map.resolutions" :key="item.value" :label="item.label"
                            :value="item.value" />
                    </el-select>

                    <div class="flex" style="margin-top: 8px;" v-if="state.formData.hign.resolution.type == '2'">
                        <el-input-number controls-position="right" v-model="state.formData.hign.resolution.resolutionW"
                            style="width: 120" />
                        <div class="flex" style="margin: 0 8px;">x</div>
                        <el-input-number controls-position="right" v-model="state.formData.hign.resolution.resolutionH"
                            style="width: 120" />
                    </div>
                </div>
            </div>

            <div class="item">
                <div class="label">字体列表</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.font.type" :options="state.map.fontsTypes" />
                    <el-select v-model="state.formData.hign.font.font" v-if="state.formData.hign.font.type == 0"
                        multiple collapse-tags placeholder="选择字体" style="width: 90%;margin-top: 8px;">
                        <el-option v-for="item in state.map.fonts" :key="item.value" :label="item.label"
                            :value="item.value" />
                    </el-select>

                </div>
            </div>

            <div class="item">
                <div class="label">字体指纹</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.fontprint" :options="state.map.fontprints" />
                </div>
            </div>

            <div class="item">
                <div class="label">WebRTC</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.webrtc" :options="state.map.webrtcs" />
                </div>
            </div>

            <div class="item" v-if="state.formData.hign.webrtc == 0 || state.formData.hign.webrtc == 2">
                <div class="label">内网IP</div>
                <div class="value">
                    <el-input class="user_agent_input" v-model="state.formData.hign.emsIP" style="width: 90%"
                        placeholder="内网IP">
                        <template #append>
                            <img src="@/assets/home/random.png" style="width: 18px;height: 18px;cursor: pointer;"
                                alt="">
                        </template>
                    </el-input>
                </div>
            </div>

            <div class="item">
                <div class="label">Canvas</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.canvas" :options="state.map.fontprints" />
                </div>
            </div>

            <div class="item">
                <div class="label">WebGL图像</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.webgl" :options="state.map.fontprints" />
                </div>
            </div>

            <div class="item">
                <div class="label">WebGL Info</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.webglInfo.type" :options="state.map.webglInfos" />
                    <div class="conent_list" v-if="state.formData.hign.webglInfo.type == 1">
                        <div class="content_item">
                            <div class="content_label" style="width: 100px;">WebGL厂商</div>
                            <div class="content_value">
                                <el-input v-model="state.formData.hign.webglInfo.firm" style="width: 100%"
                                    placeholder="WebGL厂商" />
                            </div>
                        </div>
                        <div class="content_item">
                            <div class="content_label" style="width: 100px;">WebGL渲染</div>
                            <div class="content_value">
                                <el-input class="user_agent_input" v-model="state.formData.hign.webglInfo.rendering"
                                    style="width: 100%" placeholder="WebGL渲染">
                                    <template #append>
                                        <img src="@/assets/home/random.png"
                                            style="width: 18px;height: 18px;cursor: pointer;" alt="">
                                    </template>
                                </el-input>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="item">
                <div class="label">WebGPU</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.webgpu" :options="state.map.webgpus" />
                </div>
            </div>

            <div class="item">
                <div class="label">AudioContext</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.audioContext" :options="state.map.fontprints" />
                </div>
            </div>

            <div class="item">
                <div class="label">SpeechVoices</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.speechVoices" :options="state.map.speechVoicess" />
                </div>
            </div>

            <div class="item">
                <div class="label">媒体设置</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.media" :options="state.map.fontprints" />
                </div>
            </div>

            <div class="item">
                <div class="label">硬件并发数</div>
                <div class="value">
                    <el-select v-model="state.formData.hign.concurrency" placeholder="硬件并发数" style="width: 90%">
                        <el-option v-for="item in state.map.concurrencys" :key="item.value" :label="item.label"
                            :value="item.value" />
                    </el-select>
                </div>
            </div>

            <div class="item">
                <div class="label">设备内存</div>
                <div class="value">
                    <el-select v-model="state.formData.hign.memory" placeholder="硬件并发数" style="width: 90%">
                        <el-option v-for="item in state.map.memorys" :key="item.value" :label="item.label"
                            :value="item.value" />
                    </el-select>
                </div>
            </div>

            <div class="item">
                <div class="label">Do not track</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.donottrack" :options="state.map.donottracks" />
                </div>
            </div>

            <div class="item">
                <div class="label">端口扫描保护</div>
                <div class="value">
                    <app-button3 v-model="state.formData.hign.portProtect.type" :options="state.map.speechVoicess" />
                    <el-input v-if="state.formData.hign.portProtect.type == 1"
                        v-model="state.formData.hign.portProtect.ports" :rows="3" type="textarea"
                        style="width: 90%;margin-top: 8px;" placeholder="允许被扫描的本地网络端口，用逗号隔开" />
                </div>
            </div>

        </div>
    </div>
</template>

<script setup>
const { store, state } = inject('preference_store')
</script>

<style lang="scss" scoped>
.hign_template {
    display: flex;
    flex-direction: column;

    .title {
        margin-bottom: 16px;
        color: #1d2129;
        font-size: 14px;
    }
}

.list {
    display: flex;
    flex-direction: column;


    .item {
        margin-bottom: 16px;
        display: flex;
        flex-direction: column;

        .label {
            height: 30px;
            padding-bottom: 8px;
            color: #4e5969;
            font-size: 14px;
        }

        .value {
            .text {
                margin-top: 8px;
                color: #00000073;
                font-size: 14px;
            }

            .text2 {
                margin-top: 8px;
                color: #00000073;
                font-size: 12px;
            }

        }

    }

    .between {
        height: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;

        img {
            width: 18px;
            height: 18px;
            margin-right: 8px;
        }
    }

    .flex {
        display: flex;
        align-items: center;
    }

    .column {
        display: flex;
        flex-direction: column;
    }

    .checkip_text {
        display: flex;
        flex-direction: column;
        margin-top: 8px;
        font-size: 14px;
    }

    .conent_list {
        display: flex;
        flex-direction: column;

        width: 90%;

        .content_item {
            display: flex;
            align-items: center;
            margin-top: 8px;

            .content_label {
                width: 60px;
                height: 32px;
                display: flex;
                align-items: center;
                justify-content: flex-end;
                margin-right: 16px;
                color: #1d2129;
                font-size: 14px;
            }

            .content_value {
                flex: 1;
            }
        }
    }


}
</style>